//
//  Optional+.swift
//  HoneyChat
//
//  Created by hccc on 2023/3/6.
//

import Foundation

public protocol Optionalable: ExpressibleByNilLiteral {
    associatedtype Wrapped

    var wrapped: Wrapped? { get }

    init(_ some: Wrapped)
}

extension Optional: Optionalable {
    public var wrapped: Wrapped? {
        switch self {
        case .some(let wrapped):
            return wrapped
        case .none:
            return nil
        }
    }
}
